# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=netcat-openbsd
pkgver=1.130
pkgrel=3
pkgdesc="The TCP/IP swiss army knife. OpenBSD variant."
url="https://packages.debian.org/sid/netcat-openbsd"
arch="all"
license="BSD-3-Clause"
makedepends="libbsd-dev"
subpackages="$pkgname-doc"
options="!check"
source="$pkgname-$pkgver.tar.gz::https://deb.debian.org/debian/pool/main/n/netcat-openbsd/netcat-openbsd_$pkgver.orig.tar.gz
	base64.c

	0001-port-to-linux-with-libsd.patch
	0002-connect-timeout.patch
	0003-get-sev-by-name.patch
	0004-send-crlf.patch
	0005-quit-timer.patch
	0006-udp-scan-timeout.patch
	0007-verbose-numeric-port.patch
	0008-dccp-support.patch
	0009-serialized-handling-multiple-clients.patch
	0010-misc-failures-and-features.patch
	"

prepare() {
	cd "$builddir"
	cp "$srcdir"/base64.c .
	default_prepare
	sed -i Makefile -e "/SRCS=/s;\(.*\);& base64.c;"
}

build() {
	cd "$builddir"
	make CFLAGS="$CFLAGS -DDEBIAN_VERSION=\"\\\"$pkgver\\\"\""
}

package() {
	cd "$builddir"
	install -d $pkgdir/usr/bin/
	install -d $pkgdir/usr/share/man/man1/
	install nc $pkgdir/usr/bin/nc
	install nc.1 $pkgdir/usr/share/man/man1/nc.openbsd.1
}

sha512sums="
fb2b80ccbfce364f3d376bd396f38a218127627721052694f1da24751e45a239a72c839b07b54bfc6846be6efa0c557a9cdab349711631ecff7055b763fd98e4  netcat-openbsd-1.130.tar.gz
2d4b117397e6882b0f4357bb11ca1f520746c59e0305a58f8651582a9cff17f4c59cacb14ce93de1d0fe78db5ba7fd9096c0176afc61b2c715b0b9a0444c2b4f  base64.c
06ebc872c7bedd1961b615625e3690909cdfe5c7635c5bb14826aa5a12ab333fa6cedfd38e1b1dddc00cc6b6527927dee730377c194617f7dc889edec7de410e  0001-port-to-linux-with-libsd.patch
70dca0943a8045951a50aa3897b0066b3838bec6ea58a6325b888ffe0cbace30afdce52741257ef080e36d2c1d4db2d51287d08d1a5942c0f98327343c036f27  0002-connect-timeout.patch
e4fca460b25aaa2f6ae360137bfa46b12e1329bacc59f249b46fd55246fbdc4ad8ae0eb6c3ecc4989ab92e385da7b0b9353bc3d72ca230b149b5cd93263ff893  0003-get-sev-by-name.patch
46c8a5774792590487732e4a5bcca7d5e5be1b4587cccf5c757f7198900d6e4154ef01425a846bbdd3ec52ea476db5d79e80c94620a21e29f277aadecbd1210d  0004-send-crlf.patch
21bb871a2f55d7cb5759734b16c5b64be937cf7d1a50be7995fdc8885fbcd55ef70a6173c5b266918c5aedf2dc36cf031aa2a3db9c5fcf89d834cd834ac948b4  0005-quit-timer.patch
f927d547a837314b0418f119ff0d0d83a662a90470fe1739e808c854a7fbe536326a445a2bf83a43af473a159a76d2262f68b5851b86a7a88b72ea0e69995a68  0006-udp-scan-timeout.patch
4c5ea10262098d411ea428ef1eac59d2cffa85b2d485b4af62ea71a9fd9ee2bc90644b8ba0259f5b182b371bad6a3cdbddca7818f0dd312421768ea4170bf9d6  0007-verbose-numeric-port.patch
cf3f37272e06908f7fb5ea6d1ab0217cfbc69b19dd5cfd805749498c46177efd208c62c24864ffddaeb7aa4302424d0b964909d1195d72056a000cf204b2a1cc  0008-dccp-support.patch
fff37c6854403586f1b2e838ad9ee19c511277ada17063847ecaec7066ee052980a646db76c3ffc53bf917e661bbbdc74e944e1bffeba9dc100d9521c15c3b23  0009-serialized-handling-multiple-clients.patch
ed618931b28e21b52eb8844758edaa434293217ab7f7bd064b56029bb4eef35a45d87800171c14dbef31674490ff9aa9539753ced80fa07f13b567b7e75df3b6  0010-misc-failures-and-features.patch
"
